import requests
from bs4 import BeautifulSoup

url = "https://www.dianping.com/dongyang/ch10"

header={"User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36"}

reponse = requests.get(url,headers=header)
# print(reponse.status_code)
# print(reponse.text)

soup = BeautifulSoup(reponse.text,"html.parser")
# print(soup.div)
res = soup.find_all(class_="txt")
# print(res)
for i in res:
#     # i的类型为soup
#     # 获取标签中的值采用string对象
    print(i.a.h4.text)
number=soup.find_all(class_="nebula_star")
# print(number)
# print(len(num))
for j in number:
#         #j的类型是BeautifulSoup
#         #获取标签中的值采用string对象
    # print(j.text) #评分
#         # 把tag中的子对象换成list
    print(j.contents[3].contents[0])